<html>
<head><meta charset="utf-8"><title>question re Barbara wants async insights · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html">question re Barbara wants async insights</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="233920675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233920675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233920675">(Apr 10 2021 at 03:12)</a>:</h4>
<p>I am reading over the async status quo stories and I have a question that perhaps illustrates my ignorance</p>



<a name="233920687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233920687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233920687">(Apr 10 2021 at 03:13)</a>:</h4>
<p>I’m reading <a href="https://rust-lang.github.io/wg-async-foundations/vision/status_quo/barbara_wants_async_insights.html">Barbara wants Async Insights</a></p>



<a name="233920697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233920697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233920697">(Apr 10 2021 at 03:13)</a>:</h4>
<p>the story ends with:</p>
<blockquote>
<p>After hours of crawling through the code, she notices that her task is receiving a message from a bounded async channel. She changes this to be an unbounded channel and then things start working.</p>
</blockquote>



<a name="233920758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233920758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233920758">(Apr 10 2021 at 03:14)</a>:</h4>
<p>My question (whose answer doesn’t need to be part of the story itself): Why, in this scenario, does that fix things?</p>



<a name="233920924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233920924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233920924">(Apr 10 2021 at 03:17)</a>:</h4>
<p>more specifically: I would understand if the problem here is that the bounded channel is filling up, and so the task calling <code>send</code> on the channel is being forced to wait at that point</p>



<a name="233921008"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233921008" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233921008">(Apr 10 2021 at 03:19)</a>:</h4>
<p>but the way that the story is written, it sounds like Barbara is not seeing any output ever, at all. So chaning from a bounded to an unbounded channel in just one places just sounds like she will replace her blocked task with a task that is unblocked but is also filling up an unbounded channel that is never being emptied</p>



<a name="233921020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233921020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233921020">(Apr 10 2021 at 03:19)</a>:</h4>
<p>(and thus she should see a subsequent memory leak, but no actual useful progress otherwise from her program, AFAICT)</p>



<a name="233921798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233921798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233921798">(Apr 10 2021 at 03:32)</a>:</h4>
<p>Or have I misinterpreted the story? I.e. is this something where there is a single-thread handling both the send's and the recv’s, and so if Barbara fails to process the queue fast enough, the bounded channel will fill up, and then the whole system comes to a halt as soon as a send fails?</p>



<a name="233936056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233936056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Alice Ryhl <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233936056">(Apr 10 2021 at 07:49)</a>:</h4>
<p>In <a href="https://ryhl.io/blog/actors-with-tokio/#beware-of-cycles">my blogpost on actors</a> I mention one way that bounded channels can cause deadlocks, namely if you have a cycle of them, but I don't know whether this was the intended cause.</p>



<a name="233942871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233942871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233942871">(Apr 10 2021 at 09:56)</a>:</h4>
<p>I think that was written in one of <span class="user-mention" data-user-id="224872">@rylev</span>'s sessions; I too assumed that the buffer filled up.</p>



<a name="233948425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233948425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> rylev <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233948425">(Apr 10 2021 at 11:36)</a>:</h4>
<p>The story was inspired by <span class="user-mention" data-user-id="255022">@Emmanuel Antony</span>’s experience which I believe reflected an issue similar to what <span class="user-mention" data-user-id="218683">@Alice Ryhl</span> just posted.</p>



<a name="233951010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233951010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233951010">(Apr 10 2021 at 12:20)</a>:</h4>
<p>Right, the issue is that the buffer could be filling up due to a direct cycle. Or it could be that the receiver is just ... very ... slow...</p>



<a name="233951028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233951028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233951028">(Apr 10 2021 at 12:20)</a>:</h4>
<p>Anyway I ended up writing two narratives to work around this: <a href="https://github.com/rust-lang/wg-async-foundations/pull/138">https://github.com/rust-lang/wg-async-foundations/pull/138</a></p>



<a name="233960786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/question%20re%20Barbara%20wants%20async%20insights/near/233960786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pnkfelix <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/question.20re.20Barbara.20wants.20async.20insights.html#233960786">(Apr 10 2021 at 14:48)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> let me know if you would prefer a branching narrative like this to be presented as two distinct stories on two pull requests</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>